<!--
 * @Author: wanglidong
 * @Date: 2021-04-08 09:23:01
 * @LastEditTime: 2021-08-17 08:39:44
 * @LastEditors: your name
 * @Description:
 * @FilePath:
 * @nbsg
-->
<template>
  <div class="pre-archive-detail">
    <el-dialog width="70%" class="WholeScroll" :visible.sync="formShow" @close="handleClickDeal('cancel')" v-dialog-drag :modal-append-to-body="false" :close-on-click-modal="false" append-to-body>
      <span slot="title">
        <i class="iconfont icon-yiliaozhiliangfenxi"></i>
        <span>{{ title }}</span>
      </span>

      <div class="WholeScroll" style="max-height: 650px; overflow: auto;padding: 0 15px">
        <div class="WholeScroll">
          <el-form :model="formBaseData" ref="formBaseData" :rules="formBaseRules" style="position: relative">
            <el-row>
              <div class="design-middle-box">
                <div class="left-box">
                  <p :class="chooseIndex == index?'chooseText':''" v-for="(item,index) in leftArr" :key="index" @click="chooseIndex = index">{{item.name}}</p>
                </div>
                <div class="right-box WholeScroll">
                  <div v-show="chooseIndex == 0">
                    <div v-if="!isSGPeople">
                      <el-col :span="12">
                        <el-form-item label="标段/合同段" prop="sectionId" :label-width="formlabelWidth">
                          <el-select class="select" style="width: 100%" value-key="id" v-model="formBaseData.sectionId" placeholder="选择标段/合同段" clearable disabled>
                            <el-option v-for="(item,index) in sectionList" :key="item.id+index" :label="item.name" :value="item.id">
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="公司名称" prop="companyName" :label-width="formlabelWidth">
                          <el-input v-model="formBaseData.companyName" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="姓名" prop="personName" :label-width="formlabelWidth">
                          <el-input v-model="formBaseData.personName" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="人员类型" prop="personType" :label-width="formlabelWidth">
                          <el-select class="select" style="width: 100%" value-key="id" v-model="formBaseData.personType" placeholder="选择人员类型" clearable :disabled="detailType === 'check'|| detailType === 'approve'">
                            <el-option v-for="item in personTypeList" :key="item.value" :label="item.name" :value="item.value">
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="部门" prop="dept" :label-width="formlabelWidth">
                          <el-input v-model="formBaseData.dept" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="岗位" prop="post" :label-width="formlabelWidth">
                          <el-select class="select" style="width: 100%" value-key="id" v-model="formBaseData.post" placeholder="选择岗位" filterable clearable :default-first-option="true" allow-create :disabled="detailType === 'check'|| detailType === 'approve'">
                            <el-option v-for="item in postList" :key="item.name" :label="item.name" :value="item.name">
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="进场时间" :label-width="formlabelWidth" prop="entryDate">
                          <el-date-picker v-model="formBaseData.entryDate" type="date" :picker-options="pickerOptions0" style="width: 100%;" format="yyyy-MM-dd" @change="changeEntryDate" value-format="yyyy-MM-dd" placeholder="选择进场时间" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-date-picker>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="退场时间" :label-width="formlabelWidth" prop="exitDate">
                          <el-date-picker v-model="formBaseData.exitDate" type="date" :picker-options="pickerOptions0" style="width: 100%;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择退场时间" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-date-picker>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="批复时间" :label-width="formlabelWidth" prop="approvalDate">
                          <el-date-picker v-model="formBaseData.approvalDate" type="date" style="width: 100%;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择批复时间" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-date-picker>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="定位设备编号" prop="deviceNo" :label-width="formlabelWidth">
                          <el-input v-model="formBaseData.deviceNo" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="24">
                        <el-form-item label="人员照片(头像)" :label-width="formlabelWidth">
                          <cmsUploadFileView ref="partOne" :detail-id="detailId" :fileSystem="fileSystem['one']" :disabled="detailType === 'check'|| detailType === 'approve'" type="mul" :fileList="fileListArr" info="支持上传 png/jpg/gif/doc/xlsx/ppt/pdf 文件" :detail-type="detailType" />
                        </el-form-item>
                      </el-col>
                      <el-col :span="22">
                        <el-form-item label="进场附件" :label-width="formlabelWidth">
                          <cmsUploadFile ref="partTwo" :fileList="fileListArr" :detail-id="detailId" :fileSystem="fileSystem['two']" :disabled="detailType === 'check'|| detailType === 'audit'" type="mul" info="支持上传 png/jpg/gif/doc/xlsx/ppt/pdf 文件" :detail-type="detailType" />
                        </el-form-item>
                      </el-col>
                      <el-col :span="22">
                        <el-form-item label="出场附件" :label-width="formlabelWidth">
                          <cmsUploadFile ref="partThree" :fileList="fileListArr" :detail-id="detailId" :fileSystem="fileSystem['three']" :disabled="detailType === 'check'|| detailType === 'audit'" type="mul" info="支持上传 png/jpg/gif/doc/xlsx/ppt/pdf 文件" :detail-type="detailType" />
                        </el-form-item>
                      </el-col>
                    </div>
                    <div v-if="isSGPeople">
                      <el-col :span="12">
                        <el-form-item label="标段/合同段" prop="sectionId" :label-width="formlabelWidth">
                          <el-select class="select" style="width: 100%" value-key="id" v-model="formBaseData.sectionId" placeholder="选择标段/合同段" clearable :disabled="detailType != 'build' ">
                            <el-option v-for="(item,index) in sectionList" :key="item.id+index" :label="item.name" :value="item.id">
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="公司名称" prop="companyName" :label-width="formlabelWidth">
                          <el-input v-model="formBaseData.companyName" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="姓名" prop="personName" :label-width="formlabelWidth">
                          <el-input v-model="formBaseData.personName" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="人员类型" prop="personType" :label-width="formlabelWidth">
                          <el-select class="select" style="width: 100%" value-key="id" v-model="formBaseData.personType" placeholder="选择人员类型" clearable :disabled="detailType === 'check'|| detailType === 'approve'">
                            <el-option v-for="item in personTypeList" :key="item.value" :label="item.name" :value="item.value">
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="班组" prop="teams" :label-width="formlabelWidth">
                          <el-input v-model="formBaseData.teams" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="工种" prop="workType" :label-width="formlabelWidth">
                          <el-select class="select" style="width: 100%" value-key="id" v-model="formBaseData.workType" placeholder="选择工种" filterable clearable :disabled="detailType === 'check'|| detailType === 'approve'">
                            <el-option v-for="item in postList" :key="item.name" :label="item.name" :value="item.name">
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="进场时间" :label-width="formlabelWidth" prop="entryDate">
                          <el-date-picker v-model="formBaseData.entryDate" type="date" :picker-options="pickerOptions0" style="width: 100%;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择进场时间" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-date-picker>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="退场时间" :label-width="formlabelWidth" prop="exitDate">
                          <el-date-picker v-model="formBaseData.exitDate" type="date" :picker-options="pickerOptions0" style="width: 100%;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择退场时间" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-date-picker>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="定位设备编号" prop="deviceNo" :label-width="formlabelWidth">
                          <el-input v-model="formBaseData.deviceNo" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="24">
                        <el-form-item label="人员照片(头像)" :label-width="formlabelWidth">
                          <cmsUploadFileView ref="partOne" :detail-id="detailId" :fileSystem="fileSystem['one']" :disabled="detailType === 'check'|| detailType === 'approve'" type="mul" :fileList="fileListArr" info="支持上传 png/jpg/gif/doc/xlsx/ppt/pdf 文件" :detail-type="detailType" />
                        </el-form-item>
                      </el-col>
                      <el-col :span="22">
                        <el-form-item label="进场附件" :label-width="formlabelWidth">
                          <cmsUploadFile ref="partTwo" :fileList="fileListArr" :detail-id="detailId" :fileSystem="fileSystem['two']" :disabled="detailType === 'check'|| detailType === 'audit'" type="mul" info="支持上传 png/jpg/gif/doc/xlsx/ppt/pdf 文件" :detail-type="detailType" />
                        </el-form-item>
                      </el-col>
                      <el-col :span="22">
                        <el-form-item label="出场附件" :label-width="formlabelWidth">
                          <cmsUploadFile ref="partThree" :fileList="fileListArr" :detail-id="detailId" :fileSystem="fileSystem['three']" :disabled="detailType === 'check'|| detailType === 'audit'" type="mul" info="支持上传 png/jpg/gif/doc/xlsx/ppt/pdf 文件" :detail-type="detailType" />
                        </el-form-item>
                      </el-col>
                    </div>

                  </div>
                  <div v-show="chooseIndex == 1">
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="身份证号码" prop="idcardNo" :label-width="formlabelWidth">
                          <el-input v-model="formBaseData.idcardNo" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-input>
                        </el-form-item>
                      </el-col>

                      <el-col :span="12">
                        <el-form-item label="手机号码" prop="phoneNumber" :label-width="formlabelWidth">
                          <el-input v-model="formBaseData.phoneNumber" type="number" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="性别" prop="gender" :label-width="formlabelWidth">
                          <el-radio-group v-model="formBaseData.gender" :disabled="detailType === 'check'|| detailType === 'approve'" style="width: 178px">
                            <el-radio label="1">男</el-radio>
                            <el-radio label="2">女</el-radio>
                          </el-radio-group>
                        </el-form-item>
                      </el-col>

                      <el-col :span="12">
                        <el-form-item label="年龄" prop="age" :label-width="formlabelWidth">
                          <el-input v-model="formBaseData.age" type="number" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="民族" prop="nation" :label-width="formlabelWidth">
                          <el-select class="select" style="width: 100%" value-key="id" v-model="formBaseData.nation" placeholder="选择民族" clearable :disabled="detailType === 'check'|| detailType === 'approve'">
                            <el-option v-for="item in nationList" :key="item.value" :label="item.name" :value="item.value">
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>

                      <el-col :span="12">
                        <el-form-item label="籍贯" prop="nativePlace" :label-width="formlabelWidth">
                          <el-input v-model="formBaseData.nativePlace" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="学历" prop="education" :label-width="formlabelWidth">
                          <el-select class="select" style="width: 100%" value-key="id" v-model="formBaseData.education" placeholder="选择学历" clearable :disabled="detailType === 'check'|| detailType === 'approve'">
                            <el-option v-for="item in educationList" :key="item.value" :label="item.name" :value="item.value">
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>

                      <el-col :span="12">
                        <el-form-item label="血型" prop="bloodType" :label-width="formlabelWidth">
                          <el-select class="select" style="width: 100%" value-key="id" v-model="formBaseData.bloodType" placeholder="选择血型" clearable :disabled="detailType === 'check'|| detailType === 'approve'">
                            <el-option v-for="item in bloodTypeList" :key="item.value" :label="item.name" :value="item.value">
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="紧急联系人" prop="emergencyContact" :label-width="formlabelWidth">
                          <el-input v-model="formBaseData.emergencyContact" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-input>
                        </el-form-item>
                      </el-col>

                      <el-col :span="12">
                        <el-form-item label="紧急联系人电话" prop="emergencyContactPhone" :label-width="formlabelWidth">
                          <el-input v-model="formBaseData.emergencyContactPhone" type="number" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label="家庭住址" prop="address" :label-width="formlabelWidth">
                          <el-input v-model="formBaseData.address" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-row>
                      <el-col :span="24">
                        <el-form-item label="既往病史" prop="medicalHistory" :label-width="formlabelWidth">
                          <el-input v-model="formBaseData.medicalHistory" type="textarea" :autosize="{ minRows:3, maxRows: 6}" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-row>
                      <el-col :span="24">
                        <el-form-item label="备注" prop="remarks" :label-width="formlabelWidth">
                          <el-input v-model="formBaseData.remarks" type="textarea" placeholder="请输入备注" :autosize="{ minRows:3, maxRows: 6}" :disabled="detailType === 'check'|| detailType === 'approve'">
                          </el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </div>

                  <div v-show="chooseIndex == 2">
                    <p style="color: #CB1221;">
                      *注：三类人员、特种人员必填
                    </p>
                    <el-col :span="24" style="position: relative" v-for="(item , index) in  formBaseData.certificateInforList" :key="index">
                      <div>
                        <el-col :span="12">
                          <el-form-item label="证书类别" :required="formBaseData.personType=='8afee3e189af02640189af05adfd0005'" :label-width="formlabelRightWidth">
                            <el-input style="width: 100%" v-model="item.certificateType" placeholder="" :disabled=" detailType === 'check' || detailType === 'approve' "></el-input>
                          </el-form-item>
                        </el-col>
                        <el-col :span="11">
                          <el-form-item label="证书编号" :required="formBaseData.personType=='8afee3e189af02640189af05adfd0005'" :label-width="formlabelRightWidth">
                            <el-input style="width: 100%" v-model="item.certificateNumber" placeholder="" :disabled=" detailType === 'check' || detailType === 'approve' "></el-input>
                          </el-form-item>
                        </el-col>
                        <el-col :span="1">
                          <i class="iconfont icon-add addReduceClass" @click="changeCol('add')" v-if="index==0&&detailType != 'check'&&detailType != 'approve'"></i>
                          <i class="iconfont icon-subtract addReduceClass" v-if="index>0&&detailType != 'check'&&detailType != 'approve'" @click="changeCol('reduce',index)"></i>
                        </el-col>
                        <el-col :span="12">
                          <el-form-item label="发证单位" :required="formBaseData.personType=='8afee3e189af02640189af05adfd0005'" :label-width="formlabelRightWidth">
                            <el-input style="width: 100%" v-model="item.unit" placeholder="" :disabled=" detailType === 'check' || detailType === 'approve' "></el-input>
                          </el-form-item>
                        </el-col>

                        <el-col :span="12">
                          <el-form-item label="级别" :label-width="formlabelRightWidth" :required="formBaseData.personType=='8afee3e189af02640189af05adfd0005'">
                            <el-input style="width: 100%" v-model="item.level" placeholder="" :disabled="detailType === 'check' || detailType === 'approve' "></el-input>
                          </el-form-item>
                        </el-col>
                        <el-col :span="12">
                          <el-form-item label="发证时间" :label-width="formlabelRightWidth" :required="formBaseData.personType=='8afee3e189af02640189af05adfd0005'">
                            <el-date-picker style="width: 100%;" format="yyyy-MM-dd" value-format='yyyy-MM-dd' v-model="item.grantDate" type="date" :disabled="detailType === 'check' || detailType === 'approve' " placeholder="选择发证时间">
                            </el-date-picker>
                          </el-form-item>
                        </el-col>
                        <el-col :span="12">
                          <el-form-item label="有效日期" :label-width="formlabelRightWidth" :required="formBaseData.personType=='8afee3e189af02640189af05adfd0005'">
                            <el-date-picker style="width: 100%;" format="yyyy-MM-dd" value-format='yyyy-MM-dd' v-model="item.effectDate" type="date" :disabled="detailType === 'check' || detailType === 'approve' " placeholder="选择有效日期">
                            </el-date-picker>
                          </el-form-item>
                        </el-col>
                        <el-col :span="24">
                          <el-form-item label="附件" :label-width="formlabelRightWidth">
                            <div class="actionWidth">
                              <el-upload ref="uploadFunctionRef" v-if="formBaseData.certificateInforList[index].fileList.length==0" :before-upload="(file)=>uploadFile(file,formBaseData.certificateInforList[index])" action :show-file-list="false" :before-remove="(file,fileList)=>removeFile(file,fileList)" :file-list="formBaseData.certificateInforList[index].fileList">
                                <div>
                                  <el-button v-if="detailType === 'build' || detailType === 'edit'" size="small" type="primary">
                                    <i class="iconfont icon-shangchuan"></i> 点击上传
                                  </el-button>
                                </div>
                              </el-upload>
                              <p class="fileText" v-for="(item,i) in formBaseData.certificateInforList[index].fileList" :key="i">
                                <img :src="$publicJs.filesTypeFilter(item.name, '../../../../')" alt="" />
                                <el-tooltip effect="dark" :content="item.name" placement="top">
                                  <span>{{item.name}}</span>
                                </el-tooltip>
                                <el-button @click="preview(item)" type="primary" size="mini" round icon='el-icon-view'>查看</el-button>
                                <el-button @click="download(item)" type="primary" size="mini" round icon='el-icon-download'>下载</el-button>
                                <el-upload style="margin-left: 15px" v-if="detailType!='check'" :before-upload="(file)=>uploadFile(file,formBaseData.certificateInforList[index])" action :show-file-list="false" :before-remove="(file,fileList)=>removeFile(file,fileList)" :file-list="formBaseData.certificateInforList[index].fileList">
                                  <div>
                                    <el-button size="mini" round type="primary">
                                      <div class="upload-text-style">
                                        <i class="iconfont icon-shuaxin"></i> 替换
                                      </div>
                                    </el-button>
                                  </div>
                                </el-upload>
                              </p>
                            </div>
                          </el-form-item>
                        </el-col>
                      </div>
                    </el-col>
                  </div>
                  <div v-show="chooseIndex == 3">
                    <p style="color: #CB1221;">
                      *注：近五年内工作经历
                    </p>
                    <el-col :span="24" style="position: relative" v-for="(item , index) in  formBaseData.workExperienceList" :key="index">
                      <div>
                        <el-col :span="12">
                          <el-form-item label="所在公司" :prop="'workExperienceList.'+ index +'.unit'" :label-width="formlabelRightWidth">
                            <el-input style="width: 100%" v-model="item.unit" placeholder="" :disabled=" detailType === 'check' || detailType === 'approve' "></el-input>
                          </el-form-item>
                        </el-col>
                        <el-col :span="11">
                          <el-form-item label="岗位" :prop="'workExperienceList.'+ index +'.post'" :label-width="formlabelRightWidth">
                            <el-input style="width: 100%" v-model="item.post" placeholder="" :disabled=" detailType === 'check' || detailType === 'approve' "></el-input>
                          </el-form-item>
                        </el-col>
                        <el-col :span="1">
                          <i class="iconfont icon-add addReduceClass" @click="changeColWork('add')" v-if="index==0&&detailType != 'check'&&detailType != 'approve'"></i>
                          <i class="iconfont icon-subtract addReduceClass" v-if="index>0&&detailType != 'check'&&detailType != 'approve'" @click="changeColWork('reduce',index)"></i>
                        </el-col>
                        <el-col :span="24">
                          <el-form-item label="参与重大项目" :prop="'workExperienceList.'+ index +'.majorProjects'" :label-width="formlabelRightWidth">
                            <el-input style="width: 100%" v-model="item.majorProjects" placeholder="" :disabled=" detailType === 'check' || detailType === 'approve' "></el-input>
                          </el-form-item>
                        </el-col>

                        <el-col :span="12">
                          <el-form-item label="开始时间" :label-width="formlabelRightWidth" :prop="'workExperienceList.'+ index +'.startDate'">
                            <el-date-picker style="width: 100%;" format="yyyy-MM-dd" value-format='yyyy-MM-dd' v-model="item.startDate" type="date" :disabled="detailType === 'check' || detailType === 'approve' " placeholder="选择开始时间">
                            </el-date-picker>
                          </el-form-item>
                        </el-col>
                        <el-col :span="12">
                          <el-form-item label="结束时间" :label-width="formlabelRightWidth" :prop="'workExperienceList.'+ index +'.endDate'">
                            <el-date-picker style="width: 100%;" format="yyyy-MM-dd" value-format='yyyy-MM-dd' v-model="item.endDate" type="date" :disabled="detailType === 'check' || detailType === 'approve' " placeholder="选择结束时间">
                            </el-date-picker>
                          </el-form-item>
                        </el-col>
                        <el-col :span="24">
                          <el-form-item label="附件" :label-width="formlabelRightWidth">
                            <div class="actionWidth">
                              <el-upload ref="uploadFunctionRef" v-if="formBaseData.workExperienceList[index].fileList.length==0" :before-upload="(file)=>uploadFile(file,formBaseData.workExperienceList[index])" action :show-file-list="false" :before-remove="(file,fileList)=>removeFile(file,fileList)" :file-list="formBaseData.workExperienceList[index].fileList">
                                <div>
                                  <el-button v-if="detailType === 'build' || detailType === 'edit'" size="small" type="primary">
                                    <i class="iconfont icon-shangchuan"></i> 点击上传
                                  </el-button>
                                </div>
                              </el-upload>
                              <p class="fileText" v-for="(item,i) in formBaseData.workExperienceList[index].fileList" :key="i">
                                <img :src="$publicJs.filesTypeFilter(item.name, '../../../../')" alt="" />
                                <el-tooltip effect="dark" :content="item.name" placement="top">
                                  <span>{{item.name}}</span>
                                </el-tooltip>
                                <el-button @click="preview(item)" type="primary" size="mini" round icon='el-icon-view'>查看</el-button>
                                <el-button @click="download(item)" type="primary" size="mini" round icon='el-icon-download'>下载</el-button>
                                <el-upload style="margin-left: 15px" v-if="detailType!='check'" :before-upload="(file)=>uploadFile(file,formBaseData.workExperienceList[index])" action :show-file-list="false" :before-remove="(file,fileList)=>removeFile(file,fileList)" :file-list="formBaseData.workExperienceList[index].fileList">
                                  <div>
                                    <el-button size="mini" round type="primary">
                                      <div class="upload-text-style">
                                        <i class="iconfont icon-shuaxin"></i> 替换
                                      </div>
                                    </el-button>
                                  </div>
                                </el-upload>
                              </p>
                            </div>
                          </el-form-item>
                        </el-col>
                      </div>
                    </el-col>
                  </div>
                  <div v-show="chooseIndex == 4">
                    <el-col :span="24">
                      <el-form-item label="身份证正面（国徽面）" label-width="160px" prop="fileCancel">
                        <cmsUploadFileView ref="partFour" :detail-id="detailId" :fileSystem="fileSystem['four']" :disabled="detailType === 'check'|| detailType === 'approve'" type="mul" :fileList="fileListArr" info="支持上传 png/jpg/gif/doc/xlsx/ppt/pdf 文件" :detail-type="detailType" />
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="身份证背面（人像面）" label-width="160px" prop="fileCancel">
                        <cmsUploadFileView ref="partFive" :detail-id="detailId" :fileSystem="fileSystem['five']" :disabled="detailType === 'check'|| detailType === 'approve'" type="mul" :fileList="fileListArr" info="支持上传 png/jpg/gif/doc/xlsx/ppt/pdf 文件" :detail-type="detailType" />
                      </el-form-item>
                    </el-col>
                  </div>
                  <div v-show="chooseIndex == 5">
                    <el-col :span="22">
                      <el-form-item label="合同附件" :label-width="formlabelWidth">
                        <cmsUploadFile ref="partSix" :fileList="fileListArr" :detail-id="detailId" :fileSystem="fileSystem['six']" :disabled="detailType === 'check'|| detailType === 'audit'" type="mul" info="支持上传 png/jpg/gif/doc/xlsx/ppt/pdf 文件" :detail-type="detailType" />
                      </el-form-item>
                    </el-col>
                  </div>
                </div>
              </div>
            </el-row>

          </el-form>
        </div>
      </div>

      <div slot="footer" class="dialog-footer">
        <!--api操作按钮 除去上报-->
        <!--新建和编辑的暂存上报-->
        <template v-if="detailType === 'build' || detailType === 'edit'">
          <el-button size="small" type="primary" :loading="isLoading" @click="handleClickDeal('submit', {flag: 1})">
            <i class="iconfont icon-icon_save"></i> 确 定</el-button>
        </template>
        <el-button size="small" @click="handleClickDeal('cancel')"><i class="iconfont icon-icon_cancel"></i> 取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>

import msgUtil from '@/utils/msgUtil'
import crudDict from '@/api/system/dict'
import projectSectionInfo from '@/api/buss/common'
import qualityAccidentRegistration from "@/api/buss/qualityAccidentRegistration";
import sectionInfo from "@/api/buss/sectionInfo";
import entryExitRegistration from '@/api/buss/entryExitRegistration'
const PREVIEW_URL = process.env.VUE_APP_FILE_PREVIEW
import { v4 as uuidv4 } from 'uuid';
import { getContractSectList } from "../../../../api/buss/entryExitRegistration";
export default {
  name: 'in-out-sign-detail',
  props: {
    postDetail: {
      type: Object,
      default: {
        show: false,
        type: 'build',
        params: {}
      }
    }
  },
  watch: {
    detailId(val) {
      console.log(val)
    },
    postDetail(value) {
      // 显示详情弹窗
      this.formShow = value.show
      // 初始化窗口参数
      this.activeName = 'first'
      // 详情类型
      this.detailType = value.type
      if (this.detailType == 'build') {
        this.title = '新增人员档案'
        this.isShowBpmn = true
      } else if (this.detailType == 'check') {
        this.title = '查看人员档案'
      } else if (this.detailType == 'edit') {
        this.isShowBpmn = true
        this.title = '编辑人员档案'
      }
      this.isSGPeople = value.params.showPeopleNum
      this.formBaseData.projectId = value.params.projectId
      this.personType = value.params.personType
      if (this.detailType == 'build') {
        this.formBaseData.sectionId = value.params.sectionId
        this.getCompanyName()
      }
      this.getPersonType()
      this.getPostList()
      this.getNationList()
      this.getEducationList()
      this.getBloodTypeList()
      // 详情id
      this.detailId = value.detailId ? value.detailId : '';
      if (this.isSGPeople) {
        this.$set(this, 'leftArr',
          [
            {
              name: '班组信息'
            },
            {
              name: '基本信息'
            },
            {
              name: '证书信息'
            },
            {
              name: '工作经历'
            },
            {
              name: '身份证信息'
            },
            {
              name: '合同附件'
            }
          ])
      } else {
        this.$set(this, 'leftArr',
          [
            {
              name: '部门信息'
            },
            {
              name: '基本信息'
            },
            {
              name: '证书信息'
            },
            {
              name: '工作经历'
            },
            {
              name: '身份证信息'
            }
          ])
      }
      this.getSectionList()
      // 非新建详情时 获取详情
      if (this.detailType == 'build') {

      } else {
        // 获取详情请求
        this.getDetail()
      }
    }
  },
  data() {
    return {
      pickerOptions0: {
        disabledDate: (time) => {
          if (time.getTime() > Date.now() - 8.64e6) {
            return true
          }
        }
      },
      showWbsSelectDialog: false,
      treeLoading: false, // 加载树
      wbsNodeData: [],
      colorStyle: '#000',
      showTab: false,
      happenUnit: [],
      chooseCode: '',
      isShowBpmn: false,
      isMultiple: false,
      variables: {},
      entity: {},
      fileList: [],
      wfNode: {},
      showBpmnForm: false,
      setManage: '',//项目公司选项:1项目办，2指挥部
      attributeUrl: 'buss/dailyScheduleReport/node/attribute',
      urlProcess: 'buss/dailyScheduleReport/process',
      readonly: false,

      clickIndex: 0,
      activeName_collapse: '0',
      companyTree: [],// 公司
      projectTree: [],
      sectionTree: [],
      halfYearTree: [
        { id: '1', name: '上半年' },
        { id: '2', name: '下半年' },
      ],
      chooseIndex: 0,
      leftArr: [
        {
          name: '部门信息'
        },
        {
          name: '基本信息'
        },
        {
          name: '证书信息'
        },
        {
          name: '工作经历'
        },
        {
          name: '身份证信息'
        }
      ],

      isLoading: false,
      isSGPeople: false,
      detailType: 'build', // 详情类型 build新建 check不可编辑查看 edit编辑
      detailId: '', // 当前详情的id
      fileListArr: [],
      formShow: false, // 表单展示
      formlabelWidth: '140px', // 表单左侧标题宽度
      formlabelRightWidth: '110px', // 表单左侧标题宽度
      title: '',
      activeName: 'first',
      accidentNatureList: [],
      accidentLevelList: [],
      fileSystem: {
        'one': {
          sys: 'buss',
          module: 'entryExitRegistration',
          part: 'one',
          compoName: 'partOne'
        },
        'two': {
          sys: 'buss',
          module: 'entryExitRegistration',
          part: 'two',
          compoName: 'partTwo'
        },
        'three': {
          sys: 'buss',
          module: 'entryExitRegistration',
          part: 'three',
          compoName: 'partThree'
        },
        'four': {
          sys: 'buss',
          module: 'idcard',
          part: 'four',
          compoName: 'partFour'
        },
        'five': {
          sys: 'buss',
          module: 'idcard',
          part: 'five',
          compoName: 'partFive'
        },
        'six': {
          sys: 'buss',
          module: 'entryExitRegistration',
          part: 'six',
          compoName: 'partSix'
        },
      },
      disabledArr: [],
      sectionList: [],
      personTypeList: [],
      postList: [],
      nationList: [],
      educationList: [],
      bloodTypeList: [],
      formlabelWidthThree: '120px',
      formBaseData: {
        id: '',
        companyId: '',
        projectId: '',
        sectionId: '',
        companyName: '',
        personName: '',
        personType: '',
        dept: '',
        post: '',
        entryDate: '',
        exitDate: '',
        approvalDate: '',
        deviceNo: '',
        teams: '',
        workType: '',
        idcardNo: '',
        phoneNumber: '',
        gender: '',
        age: '',
        nation: '',
        nativePlace: '',
        education: '',
        bloodType: '',
        emergencyContact: '',
        emergencyContactPhone: '',
        address: '',
        medicalHistory: '',
        remarks: '',
        certificateInforList: [{
          certificateType: '',
          certificateNumber: '',
          unit: '',
          level: '',
          grantDate: '',
          effectDate: '',
          fileList: []
        }],
        workExperienceList: [{
          unit: '',
          post: '',
          majorProjects: '',
          startDate: '',
          endDate: '',
          fileList: []
        }],
      }, // 表单基本信息内容
      formBaseRules: {
        sectionId: [
          {
            required: true,
            message: '请选择标段/合同段',
            trigger: 'change'
          }
        ],
        companyName: [
          {
            required: true,
            message: '请填写公司名称',
            trigger: 'blur'
          }
        ],
        personName: [
          {
            required: true,
            message: '请填写姓名',
            trigger: 'blur'
          }
        ],
        personType: [
          {
            required: true,
            message: '请选择人员类型',
            trigger: 'change'
          }
        ],
        dept: [
          {
            required: true,
            message: '请填写部门',
            trigger: 'blur'
          }
        ],

        post: [
          {
            required: true,
            message: '请选择岗位',
            trigger: 'change'
          }
        ],
        idcardNo: [
          {
            required: true,
            message: '请填写身份证号码',
            trigger: 'blur'
          }
        ],
        phoneNumber: [
          {
            required: true,
            message: '请输入手机号码',
            trigger: 'blur'
          }
        ],
        gender: [
          {
            required: true,
            message: '请选择性别',
            trigger: 'change'
          }
        ],
        age: [
          {
            required: true,
            message: '请输入年龄',
            trigger: 'change'
          }
        ],
        certificateType: [
          {
            required: true,
            message: '请输入证书类别',
            trigger: 'blur'
          }
        ],
        certificateNumber: [
          {
            required: true,
            message: '请输入证书编号',
            trigger: 'blur'
          }
        ],
        unit: [
          {
            required: true,
            message: '请输入发证单位',
            trigger: 'blur'
          }
        ],
        level: [
          {
            required: true,
            message: '请输入级别',
            trigger: 'blur'
          }
        ],
        grantDate: [
          {
            required: true,
            message: '请选择发证时间',
            trigger: 'change'
          }
        ],
        effectDate: [
          {
            required: true,
            message: '请选择有效日期',
            trigger: 'change'
          }
        ],
      }, // 表单基本信息验证
      pickerOptions: {
        disabledDate: (time) => {
          if (this.dateArray.includes(this.getLocalTime(time.getTime()))) {
            return true
          }
          if (time.getTime() > Date.now() - 8.64e6) {
            return true
          }
        }
      },
    }
  },
  methods: {
    changeEntryDate() {
      this.formBaseData.exitDate = ''
    },
    getBloodTypeList() {
      crudDict.getByCode('bloodType').then(res => {
        if (res.code === 200) {
          var data = res.data;
          for (var i in data) {
            this.bloodTypeList.push({ 'value': data[i].id, 'name': data[i].name });
          }
        } else {
          msgUtil.error2(res.data.message)
        }
      }).catch(() => {
        msgUtil.error2("获取人员类型失败")
      })
    },
    getEducationList() {
      crudDict.getByCode('education').then(res => {
        if (res.code === 200) {
          var data = res.data;
          for (var i in data) {
            this.educationList.push({ 'value': data[i].id, 'name': data[i].name });
          }
        } else {
          msgUtil.error2(res.data.message)
        }
      }).catch(() => {
        msgUtil.error2("获取人员类型失败")
      })
    },
    getNationList() {
      crudDict.getByCode('nation').then(res => {
        if (res.code === 200) {
          var data = res.data;
          for (var i in data) {
            this.nationList.push({ 'value': data[i].id, 'name': data[i].name });
          }
        } else {
          msgUtil.error2(res.data.message)
        }
      }).catch(() => {
        msgUtil.error2("获取人员类型失败")
      })
    },
    getPostList() {
      entryExitRegistration.getPostList().then(res => {
        if (res.code === 200) {
          var data = res.data;
          for (var i in data) {
            this.postList.push({ 'value': data[i].id, 'name': data[i].postName });
          }
        } else {
          msgUtil.error2(res.data.message)
        }
      }).catch(() => {
        msgUtil.error2("获取岗位失败")
      })
    },
    getPersonType() {
      crudDict.getByCode('personnelType').then(res => {
        if (res.code === 200) {
          var data = res.data;
          for (var i in data) {
            if (this.personType == '1') {
              if (data[i].name == '履约人员') {
                this.personTypeList.push({ 'value': data[i].id, 'name': data[i].name });
              }
            } else if (this.personType == '2') {
              if (data[i].name == '一般管理人员') {
                this.personTypeList.push({ 'value': data[i].id, 'name': data[i].name });
              }
            } else {
              if (data[i].name != '履约人员' && data[i].name != '一般管理人员') {
                this.personTypeList.push({ 'value': data[i].id, 'name': data[i].name });
              }
            }
          }
        } else {
          msgUtil.error2(res.data.message)
        }
      }).catch(() => {
        msgUtil.error2("获取人员类型失败")
      })
    },
    getCompanyName() {
      entryExitRegistration.getCompanyName({ sectionId: this.formBaseData.sectionId }).then(res => {
        if (res.code === 200) {
          this.formBaseData.companyName = res.data;
        } else {
          msgUtil.error2(res.data.message)
        }
      }).catch(() => {
        // msgUtil.error2("获取项目标段树失败")
      })
    },
    getSectionList() {
      entryExitRegistration.getContractSectList({ projectId: this.formBaseData.projectId }).then(res => {
        if (res.code === 200) {
          this.sectionList = res.data;
          if (this.personType == '3') {
            let sections = []
            this.sectionList.forEach(item => {
              if (item.type == 'section') {
                sections.push(item)
              }
            })
            this.sectionList = sections
          }
        } else {
          msgUtil.error2(res.data.message)
        }
      }).catch(() => {
        // msgUtil.error2("获取项目标段树失败")
      })
    },
    uuid() {
      return uuidv4().split('-')[0]
    },
    uploadFile(file, row) {
      console.log(file, row)
      //配置一下上传的参数
      this.$publicUpload.uploadFile(
        file,
        this.uuid(),
        'certificateWork',
        'one',
        file.name,
      ).then(res => {
        //成功的回调，往row里面塞fileName
        if (!row.fileList) {
          row.fileList = []
        }
        let arr = JSON.parse(JSON.stringify(row.fileList))
        arr = [{
          name: file.name,
          size: file.size,
          id: res.data[0],
          isLoading: false,
        }]
        this.$set(row, 'fileList', arr)
        this.$forceUpdate()
        console.log(row.fileList, 'row.fileListrow.fileListrow.fileListrow.fileList')
      }).catch(res => {

      })
    },
    preview(row) {
      this.videoUrl = ''
      //不是mp4
      this.$httpGet('/file-server/file/preview?id=' + row.id).then(response => {
        //  如果是minio地址路径，则调用kkview
        if (!response.data.startsWith("/")) {
          window.open(PREVIEW_URL + '/onlinePreview?url=' + encodeURIComponent(Base64.encode(response.data)));
        } else {
          //  如果是转换后的previewGetFile，浏览器直接打开
          window.open(response.data);
        }
      }).catch(res => {
        console.log(res)
      })
    },
    download(file) {
      this.$publicUpload.checkFile(file.id, file.name)
    },
    removeFile(file, fileList) {
      this.$confirm('确定是否删除？', '提示', {
        confirmButtonClass: 'iconfont icon-icon_ok',
        cancelButtonClass: 'iconfont icon-icon_cancel',
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'info'
      })
        .then(() => {
          fileList.forEach((item, index) => {
            if (file.id === item.id) {
              fileList.splice(index, 1)
            }
          })
          this.$publicUpload.removeFile(file.id)
        })
        .catch(() => {
        })
    },
    changeCol(val, index) {
      /* console.log(event)*/
      if (val == 'add') {
        this.formBaseData.certificateInforList.push({
          certificateType: '',
          certificateNumber: '',
          unit: '',
          level: '',
          grantDate: '',
          effectDate: '',
          fileList: []
        })
      } else if (val == 'reduce') {
        this.formBaseData.certificateInforList.splice(index, 1)
      }

      this.$forceUpdate()
    },
    changeColWork(val, index) {
      /* console.log(event)*/
      if (val == 'add') {
        this.formBaseData.workExperienceList.push({
          company: '',
          post: '',
          joinMainProject: '',
          beginTime: '',
          endTime: '',
          fileList: []
        })
      } else if (val == 'reduce') {
        this.formBaseData.workExperienceList.splice(index, 1)
      }

      this.$forceUpdate()
    },
    initData() {
      this.eventStatusList = []
      this.eventLevelList = []
      this.companyTree = []
      projectSectionInfo.getProjectSectionInfoTree().then(res => {
        if (res.code === 200) {
          var data = res.data;
          this.companyTree = data
          if (this.detailType == 'build' && this.companyTree.length > 0) {
            this.formBaseData.companyId = this.companyTree[0].id;
            this.getProjectByCompanyId()
          }
        } else {
          msgUtil.error2(res.data.message)
        }
      }).catch(() => {
        // msgUtil.error2("获取项目标段树失败")
      })
      crudDict.getByCode('accident-nature').then(res => {
        if (res.code === 200) {
          var data = res.data;
          for (var i in data) {
            this.accidentNatureList.push({ 'value': data[i].id, 'name': data[i].name });
          }
        } else {
          msgUtil.error2(res.data.message)
        }
      }).catch(() => {
        msgUtil.error2("获取性质失败")
      })

      crudDict.getByCode('accident-level').then(res => {
        if (res.code === 200) {
          var data = res.data;
          for (var i in data) {
            this.accidentLevelList.push({ 'value': data[i].id, 'name': data[i].name });
          }
        } else {
          msgUtil.error2(res.data.message)
        }
      }).catch(() => {
        msgUtil.error2("获取等级失败")
      })
    },
    saveFiles() {
      for (let k in this.fileSystem) {
        let fileProp = this.fileSystem[k]
        this.$refs[fileProp.compoName].saveAll(this.detailId)
      }
    },
    loadFiles() {
      this.$nextTick(() => {
        for (let k in this.fileSystem) {
          let fileProp = this.fileSystem[k]
          this.$refs[fileProp.compoName].init()
        }
      })
    },

    // 公司下拉
    getProjectSectionInfoTree() {
      return projectSectionInfo.getProjectSectionInfoTree().then(res => {
        if (res.code === 200) {
          var data = res.data;
          this.companyTree = data;
          if (this.companyTree.length > 0) {
            if (this.detailType == 'build') {
              this.formBaseData.companyId = this.companyTree[0].id;
            }
          }
          this.getProjectByCompanyId();
        } else {
          msgUtil.error2(res.data.message)
        }
      })
    },

    /**
     *  根据建设单位查询下面的所有项目
     * */
    getProjectByCompanyId() {
      this.companyTree.forEach((item) => {
        if (item.id === this.formBaseData.companyId) {
          this.projectTree = item.children
          if (this.projectTree.length > 0) {
            if (this.detailType == 'build') {
              this.formBaseData.projectId = this.projectTree[0].id;
            }
          } else {
            this.formBaseData.projectId = '';
          }
        }
      })
      if (this.formBaseData.companyId == '') {
        this.formBaseData.projectId = '';
      }
      this.$forceUpdate()
      // 项目存在时 查询合同段
      this.getSectionByProjectId();
    },

    /**
     * 根据 项目获取合同段
     *
     */
    getSectionByProjectId() {
      if (!this.formBaseData.projectId) {
        this.formBaseData.sectionId = ''
      }
      if (this.formBaseData.projectId) {
        this.projectTree.forEach((item) => {
          if (item.id === this.formBaseData.projectId) {
            this.sectionTree = item.children
            if (this.sectionTree.length > 0) {
              if (this.detailType == 'build') {
                this.formBaseData.sectionId = this.sectionTree[0].id;
                this.sectionChange();
              }
            } else {
              this.formBaseData.sectionId = '';
            }
          }
        })
      }

    },

    // 标段变更事件
    sectionChange() {
      this.formBaseData.constructionUnit = ''
      this.changeSectionInfo(this.formBaseData.sectionId)
    },

    changeSectionInfo(sectionId) {
      sectionInfo.getCompanyBySecId(sectionId).then(res => {
        if (res.status === 1) {
          this.formBaseData.constructionUnit = res.data.buildUnit
          this.$forceUpdate()
        } else {
          msgUtil.error2(res.data.message)
        }
      }).catch(() => {
        msgUtil.error2("获取标段相关单位失败")
      })
    },

    //
    getDataByContractId() {
      if (!this.formBaseData.contractId) {
        return;
      }
      if (!this.formBaseData.year) {
        return;
      }
      let postData = {
        contractId: this.formBaseData.contractId,
        year: this.formBaseData.year
      }
      this.$httpPost(
        `buss/dailyScheduleReport/getAlreadyHalfYear`, postData
      ).then((res) => {
        if (res.code == 200) {
          this.formBaseData.halfYear = '';
          console.log(res.data);
          this.$set(this, 'disabledArr', res.data)
        }
      }).catch((res) => {
        console.log('请求出现错误', res)
        this.$messageError(this.$route.name + '获取详情请求-请求失败')
      })
    },
    // 获取详情请求 api
    getDetail() {
      entryExitRegistration.getOne(this.detailId).then(res => {
        if (res.code == 200) {
          this.formBaseData = res.data
          if (this.formBaseData.certificateInforList.length == 1) {
            if (!this.formBaseData.certificateInforList[0].certificateType) {
              this.$set(this.formBaseData.certificateInforList[0], 'certificateType', '')
              this.$set(this.formBaseData.certificateInforList[0], 'certificateNumber', '')
              this.$set(this.formBaseData.certificateInforList[0], 'unit', '')
              this.$set(this.formBaseData.certificateInforList[0], 'level', '')
              this.$set(this.formBaseData.certificateInforList[0], 'grantDate', '')
              this.$set(this.formBaseData.certificateInforList[0], 'effectDate', '')
              this.$set(this.formBaseData.certificateInforList[0], 'fileList', [])
            }
          }
          this.$forceUpdate()
          this.loadFiles()
        } else {
          msgUtil.error2(res.data.message)
        }
      }).catch(() => {
        msgUtil.error2("获取详情信息失败")
      })
    },



    // 提交详情 提交1/暂存0 新建0/修改1
    submitDetail(type, callback) {
      if (this.personType == '3') {
        if (this.formBaseData.certificateInforList == null || this.formBaseData.certificateInforList.length == 0) {
          msgUtil.error2("一般作业人员，特种作业人员需填写证书信息！")
          return
        }
      }
      if (this.detailType === 'build') {
        this.isLoading = true
        entryExitRegistration.submit(this.formBaseData).then(res => {
          if (res.code === 200) {
            this.formShow = false
            this.detailId = res.data.id
            if (callback) callback()
          } else {

            msgUtil.error2(res.data.message)
          }
        }).catch((res) => {
          console.log(res)
        }).finally((response) => {
          this.isLoading = false
        })
      } else {
        this.isLoading = true
        entryExitRegistration.resubmit(this.formBaseData).then(res => {
          if (res.code === 200) {
            this.formShow = false
            this.detailId = res.data.id
            if (callback) callback()
          } else {
            msgUtil.error2(res.data.message)
          }
        }).catch((res) => {
          console.log(res)
        }).finally((response) => {
          this.isLoading = false
        })
      }
    },

    // 点击各个流程的按钮事件
    handleClickDeal(type, res) {
      switch (type) {
        // 取消，关闭窗口
        case 'cancel':
          // 重置表单验证
          this.$refs['formBaseData'].resetFields()
          // 重置表单验证
          this.formBaseData = {
            id: '',
            companyId: '',
            projectId: '',
            sectionId: '',
            companyName: '',
            personName: '',
            personType: '',
            dept: '',
            post: '',
            entryDate: '',
            exitDate: '',
            approvalDate: '',
            deviceNo: '',
            teams: '',
            workType: '',
            idcardNo: '',
            phoneNumber: '',
            gender: '',
            age: '',
            nation: '',
            nativePlace: '',
            education: '',
            bloodType: '',
            emergencyContact: '',
            emergencyContactPhone: '',
            address: '',
            medicalHistory: '',
            remarks: '',
            certificateInforList: [{
              certificateType: '',
              certificateNumber: '',
              unit: '',
              level: '',
              grantDate: '',
              effectDate: '',
              fileList: []
            }],
            workExperienceList: [{
              unit: '',
              post: '',
              majorProjects: '',
              startDate: '',
              endDate: '',
              fileList: []
            }],
          }
          // 清空文件
          this.fileList = []
          // for (let k in this.fileSystem) {
          //   let fileProp = this.fileSystem[k]
          //   this.$refs[fileProp.compoName].cancelAll()
          // }
          this.bloodTypeList = []
          this.disabledArr = []
          this.sectionList = []
          this.personTypeList = []
          this.postList = []
          this.nationList = []
          this.educationList = []
          this.bloodTypeList = []
          this.chooseIndex = 0
          // 关闭弹窗
          this.formShow = false
          break
        // 保存
        case 'submit':
          let flag = res.flag
          // 表单验证
          if (this.formBaseData.personType == '8afee3e189af02640189af05adfd0005') {
            for (let i in this.formBaseData.certificateInforList) {
              let item = this.formBaseData.certificateInforList[i]
              if (item.certificateType == '') {
                this.$messageWarning('请填写证书类别')
                return
              }
              if (item.certificateNumber == '') {
                this.$messageWarning('请填写证书编号')
                return
              }
              if (item.unit == '') {
                this.$messageWarning('请填写发证单位')
                return
              }
              if (item.level == '') {
                this.$messageWarning('请填写级别')
                return
              }
              if (item.grantDate == '') {
                this.$messageWarning('请选择发证时间')
                return
              }
              if (item.effectDate == '') {
                this.$messageWarning('请选择有效日期')
                return
              }
            }
          }
          this.$refs['formBaseData'].validate((valid) => {
            if (valid) {
              // 提交详情
              this.submitDetail(flag, () => {
                this.saveFiles()
                this.$emit('reloadList')
                this.$notify({
                  title: '进出场登记保存成功',
                  type: 'success',
                  duration: 1500
                })
              }, true)
            }
          })
          break

      }
    },

    /**
     *显示删除按钮
     * @param row
     */
    buttonDelShow(row) {
      let flag = false
      if (
        (this.detailType === 'build' || this.detailType === 'edit') &&
        row.file[0].realName !== '' &&
        !row.isNeed
      ) {
        flag = true
      }
      // 多文件上传的控制的控制
      if (row.isMulti) {
        flag = false
      }
      return flag
    },
    /**
     *控制显示暂无文件
     * @param row
     */
    showNone(row) {
      let flag = false
      if (
        this.detailType !== 'build' &&
        this.detailType !== 'edit' &&
        row.file[0].realName === ''
      ) {
        flag = true
      }
      return flag
    },
    /**
     * 控制查看按钮显示
     * @param row
     */
    buttonCheckShow(row) {
      let flag = false
      if (
        this.detailType !== 'build' &&
        this.detailType !== 'edit' &&
        row.file[0].realName !== ''
      ) {
        flag = true
      }

      if (row.isMulti) {
        flag = false
      }
      return flag
    },
    /**
     * 控制上传按钮显示
     * @param row
     * @returns {boolean}
     */
    buttonUploadShow(row) {
      let flag = false
      if (this.detailType === 'build' || this.detailType === 'edit') {
        flag = true
      }
      return flag
    },
    tableChange(val) {
      this.$set(this, 'buildUnitTable', [...val])
    },

  }
}
</script>

<style scoped lang="scss">
$borderColor: #c0c4cc;
.contract-ele {
  width: 100%;
}
.el-input .el-select {
  width: 130px;
}
.formTitle {
  font-weight: bold;
  font-size: 16px;
}

.hoverTxt {
  color: #008fe0;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.design-middle-box {
  border: 1px $borderColor solid;
  display: flex;
  flex-direction: row;
  .left-box {
    min-width: 200px;
    padding: 15px;
    border-right: 1px $borderColor solid;
    p {
      cursor: pointer;
    }
  }
  .right-box {
    flex-grow: 1;
    padding: 15px;
  }
  .chooseText {
    color: #008fe0;
  }
}
.actionWidth {
  div:nth-child(1) {
    display: inline-block;
  }
}
.fileText {
  cursor: pointer;
  margin: 0;
  padding-left: 10px;
  display: flex;
  align-items: center;
  img {
    height: 20px;
    margin-right: 15px;
  }
  span {
    width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: keep-all;
    margin-right: 15px;
  }
}
.fileText:hover {
  background-color: rgb(245, 247, 250);
}
.blueText {
  color: #0c8bff;
  margin-left: 15px;
  cursor: pointer;
}
.addReduceClass {
  position: absolute;
  right: 5px;
  font-size: 40px;
  top: -5px;
  cursor: pointer;
}
.addReduceClass:hover {
  color: #66b1ff;
}
</style>
<style lang="scss">
.dateRed span {
  border: 1px solid #29b2f5;
  border-radius: 50%;
}
</style>
